@extends('layouts.home')
@section('title', '沃势管理后台')
@section('style')
    <link href="../plugins/timepicker/bootstrap-timepicker.min.css" rel="stylesheet">
    <link href="../plugins/bootstrap-colorpicker/css/bootstrap-colorpicker.min.css" rel="stylesheet">
    <link href="../plugins/bootstrap-datepicker/css/bootstrap-datepicker.min.css" rel="stylesheet">
    <link href="../plugins/clockpicker/css/bootstrap-clockpicker.min.css" rel="stylesheet">
    <link href="../plugins/bootstrap-daterangepicker/daterangepicker.css" rel="stylesheet">
    <!-- Plugins css-->
    <link href="../plugins/multiselect/css/multi-select.css"  rel="stylesheet" type="text/css" />
    <link href="../plugins/select2/css/select2.min.css" rel="stylesheet" type="text/css" />
    <link href="../plugins/bootstrap-select/css/bootstrap-select.min.css" rel="stylesheet" />
@endsection
@section('content')
    <div class="card-box">
        <div class="row">
            <form action="{{route('setting.user.log')}}" method="get">
                <div class="col-sm-1">
                    <select class="form-control select2" name="user_id">
                        <option value="">请选择用户</option>
                        @foreach($users as $u)
                            <option value="{{ $u->id }}" @if($u->id == request('user_id'))) selected @endif>{{ $u->name }}</option>
                        @endforeach
                    </select>
                </div>
                <div class="col-sm-3">
                    <div>
                        <div class="input-daterange input-group" id="date-range">
                            <input type="text" class="form-control" name="start" placeholder="开始时间" value="{{ request('start') }}" />
                            <span class="input-group-addon bg-custom text-white b-0">to</span>
                            <input type="text" class="form-control" name="end" placeholder="结束时间" value="{{ request('end') }}" />
                        </div>
                    </div>
                </div>
                <div class="col-sm-3">
                    <span class="input-group-btn" style="">
                        <button type="submit" class="btn btn-default waves-effect w-md m-b-1">查询</button>
                    </span>
                </div>
            </form>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-12">
            <div class="card-box">

                <div class="table-rep-plugin">
                    <div class="table-responsive" data-pattern="priority-columns">
                        <table class="tablesaw table m-b-0" data-tablesaw-mode="swipe" data-tablesaw-mode-switch data-tablesaw-minimap>
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>操作模块</th>
                                <th>请求类型</th>
                                <th>IP地址</th>
                                <th>操作时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            @foreach($logs as $l)
                                <tr>
                                    <td>{{ $l->user_name }}</td>
                                    <td>{{ $l->route }}</td>
                                    <td>{{ $l->method }}</td>
                                    <td>{{ $l->ip }}</td>
                                    <td>{{ $l->time }}</td>
                                    <td>
                                        <a href="#" data-toggle="modal" data-target="#myModal{{ $l->id }}">查看详细</a>
                                        <!-- sample modal content -->
                                        <div id="myModal{{ $l->id }}" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                                            <div class="modal-dialog">
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                                                        <h4 class="modal-title" id="myModalLabel">日志详细信息</h4>
                                                    </div>
                                                    <div class="modal-body">
                                                        <table>
                                                            <tr>
                                                                <td>操作用户</td>
                                                                <td>{{ $l->user_name }}</td>
                                                            </tr>
                                                            <tr>
                                                                <td>操作模块</td>
                                                                <td>{{ $l->route }}</td>
                                                            </tr>
                                                            <tr>
                                                                <td>请求类型</td>
                                                                <td>{{ $l->method }}</td>
                                                            </tr>
                                                            <tr>
                                                                <td>IP地址</td>
                                                                <td>{{ $l->ip }}</td>
                                                            </tr>
                                                            <tr>
                                                                <td>操作时间</td>
                                                                <td>{{ $l->time }}</td>
                                                            </tr>
                                                            <tr>
                                                                <td>请求参数</td>
                                                                <td>{{ $l->params ? dump(json_decode($l->params, true)) : '' }}</td>
                                                            </tr>
                                                        </table>
                                                    </div>
                                                    <div class="modal-footer">
                                                        <button type="button" class="btn btn-default waves-effect" data-dismiss="modal">关闭</button>
                                                    </div>
                                                </div><!-- /.modal-content -->
                                            </div><!-- /.modal-dialog -->
                                        </div><!-- /.modal -->
                                    </td>
                                </tr>
                            @endforeach

                            </tbody>
                        </table>
                        <div align="right">
                            {{ $logs->links() }}
                        </div>
                    </div>

                </div>

            </div>
        </div>
    </div>
    <!-- end row -->
    @section('script')
        <script src="../plugins/select2/js/select2.min.js" type="text/javascript"></script>
        <script src="../plugins/bootstrap-select/js/bootstrap-select.min.js" type="text/javascript"></script>
        <script>
            $('.select2').select2();
        </script>
        <script src="../plugins/moment/moment.js"></script>
        <script src="../plugins/timepicker/bootstrap-timepicker.js"></script>
        <script src="../plugins/bootstrap-colorpicker/js/bootstrap-colorpicker.min.js"></script>
        <script src="../plugins/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>
        <script src="../plugins/clockpicker/js/bootstrap-clockpicker.min.js"></script>
        <script src="../plugins/bootstrap-daterangepicker/daterangepicker.js"></script>
        <!-- Init js -->
        <script src="assets/pages/jquery.form-pickers.init.js"></script>
    @endsection
@stop














